#include <iostream>
#include <set>
using namespace std;

set<long long> se;

const long long INF = 1e10 + 10;

int main(){
	int n;
	cin >> n;
	se.insert(-INF);se.insert(INF);
	while(n--){
		int op,x;
		cin >> op >> x;
		if(op == 1){
			if(se.count(x)){
				cout << "Already Exist" << endl;
			}
			else{
				se.insert(x);
			}
		}
		else{
			if(se.count(x)){
				cout << x << endl;
				se.erase(x);
			}
			else if(se.size() > 2){
				auto it = se.lower_bound(x);
				auto tmp = it;
				tmp--;
				if(x - *tmp > *it - x){
					cout << *it << endl;
					se.erase(*it);
				}
				else if(x - *tmp < *it - x){
					cout << *tmp << endl;
					se.erase(*tmp);
				}
				else if(x - *tmp == *it - x){
					cout << *tmp << endl;
					se.erase(*tmp);
				}
			}
			else{
				cout << "Empty" << endl;
			}
		}
	}
	return 0;
} 
